===============
= Source File =
===============
#pyev1
eirika = SpeakStyle(nid="e", speaker="Eirika", num_lines=3)

$u eirika "FarLeft" ExpressionList=["Smile", "CloseEyes"] Slide="right"
$say eirika "Four score and seven years ago" FontColor="green"
$r eirika

for i in range(5):
    $make_generic str(i) "Citizen" 1 "player"
    $add_unit str(i) "Bone" "immediate" "closest"

seth_unit = u("Seth")
$set_stats seth_unit {"HP": 5, "LCK": 6}, immediate

$u seth_unit "Right"
$say seth_unit "What happened to my HP?" NumLines=1

times = 0;
while times < 5:
    times += 1
    $say seth_unit "I'm trapped in a strange loop..."
    $say seth_unit "What is going on?"

=======================
= SWS Compiled Source =
=======================
#pyev1
eirika = SpeakStyle(nid="e", speaker="Eirika", num_lines=3)

__COMMAND_SENTINEL
__COMMAND_SENTINEL
__COMMAND_SENTINEL

for i in range(5):
__COMMAND_SENTINEL
__COMMAND_SENTINEL

seth_unit = u("Seth")
__COMMAND_SENTINEL

__COMMAND_SENTINEL
__COMMAND_SENTINEL

times = 0;
while times < 5:
    times += 1
__COMMAND_SENTINEL
__COMMAND_SENTINEL

============================
= Parsed token information =
============================
source=$u eirika "FarLeft" ExpressionList=["Smile", "CloseEyes"] Slide="right"
start_idx=0
	token='u' at idx='1'
	token='eirika' at idx='3'
	token='"FarLeft"' at idx='10'
	token='ExpressionList=["Smile", "CloseEyes"]' at idx='20'
	token='Slide="right"' at idx='58'

~~~~~~~~~~
source=$say eirika "Four score and seven years ago" FontColor="green"
start_idx=0
	token='say' at idx='1'
	token='eirika' at idx='5'
	token='"Four score and seven years ago"' at idx='12'
	token='FontColor="green"' at idx='45'

~~~~~~~~~~
source=$r eirika
start_idx=0
	token='r' at idx='1'
	token='eirika' at idx='3'

~~~~~~~~~~
source=    $make_generic str(i) "Citizen" 1 "player"
start_idx=4
	token='make_generic' at idx='5'
	token='str(i)' at idx='18'
	token='"Citizen"' at idx='25'
	token='1' at idx='35'
	token='"player"' at idx='37'

~~~~~~~~~~
source=    $add_unit str(i) "Bone" "immediate" "closest"
start_idx=4
	token='add_unit' at idx='5'
	token='str(i)' at idx='14'
	token='"Bone"' at idx='21'
	token='"immediate"' at idx='28'
	token='"closest"' at idx='40'

~~~~~~~~~~
source=$set_stats seth_unit {"HP": 5, "LCK": 6}, immediate
start_idx=0
	token='set_stats' at idx='1'
	token='seth_unit' at idx='11'
	token='{"HP": 5, "LCK": 6}' at idx='21'
	token='immediate' at idx='42'

~~~~~~~~~~
source=$u seth_unit "Right"
start_idx=0
	token='u' at idx='1'
	token='seth_unit' at idx='3'
	token='"Right"' at idx='13'

~~~~~~~~~~
source=$say seth_unit "What happened to my HP?" NumLines=1
start_idx=0
	token='say' at idx='1'
	token='seth_unit' at idx='5'
	token='"What happened to my HP?"' at idx='15'
	token='NumLines=1' at idx='41'

~~~~~~~~~~
source=    $say seth_unit "I'm trapped in a strange loop..."
start_idx=4
	token='say' at idx='5'
	token='seth_unit' at idx='9'
	token='"I'm trapped in a strange loop..."' at idx='19'

~~~~~~~~~~
source=    $say seth_unit "What is going on?"
start_idx=4
	token='say' at idx='5'
	token='seth_unit' at idx='9'
	token='"What is going on?"' at idx='19'

~~~~~~~~~~
========================
= Static Analyzer Code =
========================
#pyev1
eirika = SpeakStyle(nid="e", speaker="Eirika", num_lines=3)

EC.u(eirika,"FarLeft",ExpressionList=["Smile", "CloseEyes"],Slide="right").set_flags()
EC.say(eirika,"Four score and seven years ago",FontColor="green").set_flags()
EC.r(eirika).set_flags()

for i in range(5):
    EC.make_generic(str(i),"Citizen",1,"player").set_flags()
    EC.add_unit(str(i),"Bone","immediate","closest").set_flags()

seth_unit = u("Seth")
EC.set_stats(seth_unit,{"HP": 5, "LCK": 6}).set_flags("immediate")

EC.u(seth_unit,"Right").set_flags()
EC.say(seth_unit,"What happened to my HP?",NumLines=1).set_flags()

times = 0;
while times < 5:
    times += 1
    EC.say(seth_unit,"I'm trapped in a strange loop...").set_flags()
    EC.say(seth_unit,"What is going on?").set_flags()

============================
= Final Compilation Output =
============================

import app.events.python_eventing.python_event_command_wrappers as EC
from app.events.python_eventing.utils import DO_NOT_EXECUTE_SENTINEL, ResumeCheck
from app.events.speak_style import SpeakStyle
from app.constants import WINHEIGHT, WINWIDTH
from app.engine import (action, background, dialog, engine, evaluate,
                        image_mods, item_funcs)
from app.engine.movement import movement_funcs
from app.utilities import str_utils, utils, static_random

_PTR = 0
def _lt_event_gen():
	#pyev1
	eirika = SpeakStyle(nid="e", speaker="Eirika", num_lines=3)
	
	yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 1 and RESUME_CHECK.check_set_caught_up(1)) else 1, EC.u(eirika,"FarLeft",ExpressionList=["Smile", "CloseEyes"],Slide="right").set_flags())
	yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 2 and RESUME_CHECK.check_set_caught_up(2)) else 2, EC.say(eirika,"Four score and seven years ago",FontColor="green").set_flags())
	yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 3 and RESUME_CHECK.check_set_caught_up(3)) else 3, EC.r(eirika).set_flags())
	
	for i in range(5):
	    yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 4 and RESUME_CHECK.check_set_caught_up(4)) else 4, EC.make_generic(str(i),"Citizen",1,"player").set_flags())
	    yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 5 and RESUME_CHECK.check_set_caught_up(5)) else 5, EC.add_unit(str(i),"Bone","immediate","closest").set_flags())
	
	seth_unit = u("Seth")
	yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 6 and RESUME_CHECK.check_set_caught_up(6)) else 6, EC.set_stats(seth_unit,{"HP": 5, "LCK": 6}).set_flags("immediate"))
	
	yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 7 and RESUME_CHECK.check_set_caught_up(7)) else 7, EC.u(seth_unit,"Right").set_flags())
	yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 8 and RESUME_CHECK.check_set_caught_up(8)) else 8, EC.say(seth_unit,"What happened to my HP?",NumLines=1).set_flags())
	
	times = 0;
	while (_PTR in [9, 10] and RESUME_CHECK.catching_up) or times < 5:
	    times += 1
	    yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 9 and RESUME_CHECK.check_set_caught_up(9)) else 9, EC.say(seth_unit,"I'm trapped in a strange loop...").set_flags())
	    yield (DO_NOT_EXECUTE_SENTINEL if (_PTR >= 10 and RESUME_CHECK.check_set_caught_up(10)) else 10, EC.say(seth_unit,"What is going on?").set_flags())
	
